1. Field of the Invention
The present invention relates to a file system, a file recording method, and a file reading method. More particularly, the present invention relates to a file system, a file recording method, and a file reading method capable of inputting/outputting a large amount of data which needs to be read/written in real time, such as video data and audio data.
2. Description of the Related Art
In recent years, standardization of digital compression techniques, such as MPEG 1 and MPEG 2, has proceeded. Also, a high performance CPU (central processing unit), memory, and data accumulating medium are available with low prices. Under this circumstance, many types of multimedia apparatuses for accumulating video and audio data by digitalizing it and for processing a large amount of digital data are commercialized.
When digitalized video and audio data is written to a recording medium or read from a recording medium, a file managing apparatus (called a file system) allocates clusters, manages unused clusters, and manages data list information, as in reading/writing data in a computer.
In a file system, a data area of a recording medium is divided into one or more clusters, each having a specific fixed length, and a cluster map for managing a use condition of each cluster is provided. In a typical computer, a size of each cluster is set to 512 bytes, 2 kilobytes, or 4 kilobytes.
When data is recorded or played back in units of clusters, a recording or playback process is performed based on a unit called a block on a recording medium.
The block is a unit of recording/playback and has a fixed length which is set in each recording medium. In a hard disk, the capacity of the block is usually 512 bytes. The block is accessed based on a number (address) corresponding to a logical block. In a hard disk, by specifying an address of a block at a start position of recording or playback and the number of blocks to be recorded or played back, data of sequential blocks starting from the specified block can be transferred.
The above-mentioned cluster is composed of an integral multiple of the block, and sequential addresses are assigned thereto. In such a file system, sequentiality of blocks is ensured in one cluster, and thus input/output of data is performed in units of clusters (repeats input/output in units of clusters).
In the file system, however, since an area is obtained in units of clusters, the area is fragmented by repeated creation and deletion of files. That is, it becomes difficult to keep clusters forming a sequential file, and as a result, data cannot be transferred continuously.
When data is not continuously transferred in a disk-shaped recording medium, such as a hard disk, seek time for moving a disk head to a cylinder position including a target block (sector) and waiting time until the target sector reaches a head position cause degradation in performance.
For this reason, when disk performance needs to be increased in a file system, the number of blocks forming one cluster may be increased. Accordingly, the sequentiality of blocks forming a cluster can be ensured, and thus many blocks can be input/output at one time even if fragmentation occurs.
However, using such a large cluster involves a problem. That is, even if a data size of a created file is small, e.g., 1 byte, the file occupies one large cluster. The cluster is regarded as a used cluster, which decreases effective usage efficiency. Also, a large amount of data equivalent to one cluster must be transferred in order to input/output only 1-byte data, which is inefficient.
In an apparatus (e.g., a personal computer) dealing with both a file of small data size and a file requiring an input/output performance, such as a stream data file represented by an MPEG 2 data file, a tradeoff between usage efficiency and an input/output performance must be considered.
In a conventional file system, dealing with a plurality of stream data files at the same time is not taken into consideration. When a plurality of stream data files are simultaneously dealt with, for example, when recorded program data is played back while another program data is being recorded, when a program is played back while recording it, or when data of a plurality of programs is recorded at the same time, a technique of protecting a realtime performance against input/output of a normal file which asynchronously interrupts is required.